<form method="post" name="show_featured_form" action="">
<input type="hidden" name="set_published" value="1">
<input type="hidden" name="form" value="">
<table class="Centered List" border="0">
	<tr class="HeaderTr">
		<td colspan="7" class="LeftAlign"><b>Featured Properties</b></td>
	</tr>
	<tr class="HeaderTr">
		<th width="15px"><input type="checkbox" name="" onclick="select_all(this);" /></th>
		<th width="5%">Unit ID</th>
		<th class="LeftAlign">Unit Name</th>
		<th width="15%">Start Featured After Date</th>
		<th width="15%">End Featured After Date</th>
		<th width="15%">Featured Published</th>
		<th width="8%">Order</th>
	</tr>
	<?php if(!empty($featured_units)){
			foreach ($featured_units as $key=>$featured_unit){
	?>
	<tr class="<?php echo($key%2 == 0 ? 'row0' : 'row1'); ?>">
		<td width="15px"><input type="checkbox" name="featured[]" value="<?php echo $featured_unit->id?>" /></td>
		<td width="5%"><?php echo $featured_unit->id;?></td>
		<td class="LeftAlign"><?php echo $featured_unit->units->name?></td>
		<td width="25%"><?php echo get_string_from_date($featured_unit->featured_start_date);?></td>
		<td width="25%"><?php echo get_string_from_date($featured_unit->featured_end_date);?></td>
		<td width="10%">
			<?php if($featured_unit->published){?>
			<a href="javascript:void(0)" onclick="alter_featured_published(0, <?php echo $featured_unit->id; ?>)"><img alt="published" src="<?php echo COMPONENT_PATH."images/published.png";?>"></a>
			<?php }else{?>
			<a href="javascript:void(0)" onclick="alter_featured_published(1, <?php echo $featured_unit->id; ?>)"><img alt="not published" src="<?php echo COMPONENT_PATH."images/cross.png";?>"></a>
			<?php }?>
		</td>
		<td width="8%"><input type="text" name="featured[order][]" size="5" /><?php $featured_unit->order;?></td>
	</tr>
	<?php }
	}?>
</table>
</form>
<?php $KToolBar->addLink('<a href="?option='.COMPONENT_NAME.'&page=featured&action=new"><img border="0" alt="New" src="images/new_f2.png"/><br />New</a>');?>
<?php $KToolBar->addLink('<a href="#" onclick="set_published(\'show_featured_form\', 1)"><img border="0" alt="Publish" src="images/publish_f2.png"/><br />Publish</a>');?>
<?php $KToolBar->addLink('<a href="#" onclick="set_published(\'show_featured_form\', 0)"><img border="0" alt="Unpublish" src="images/cancel_f2.png"/><br />Unpublish</a>');?>

<script type="text/javascript">
function alter_featured_published(state, id){
	$.post("<?php echo COMPONENT_PATH."functions/alter_featured_published.php";?>", { published: state, id: id },
	function(data){
		if(data == "error") alert("Some error occured");
	});
}
</script>
